
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.users.User,
                 com.scalar.chiptrack.commons.SessionKeys,
                 com.scalar.chiptrack.users.Functionality,
                 com.scalar.chiptrack.sales.forms.SendAckMailForm,
				 com.scalar.chiptrack.sales.SalesOrder,
				 com.scalar.chiptrack.sales.dao.SalesOrderDAO,
				 java.util.ArrayList,
                 com.scalar.chiptrack.commons.Constants" %>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/sendAckMail.do"/>

<html:html>

<HEAD><TITLE>ChipTrac - Send Email</TITLE>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>


<%
    User user = ( User ) session.getAttribute( SessionKeys.USER_KEY );
    String fromUser = user.getEmail();


    SendAckMailForm sendAckMailForm = ( SendAckMailForm ) request.getAttribute( "sendAckMailForm" );
    if( sendAckMailForm == null ) sendAckMailForm = new SendAckMailForm();

%>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/validations.js">
</SCRIPT>


<style>
<!--
a.nav:link   { font-family: Verdana,Arial,San Serif; font-size: 10px; text-decoration: underline }
a.nav:visited { font-family: Verdana,Arial,San Serif; font-size: 10px; text-decoration: none }
a.nav:active { font-family: Verdana,Arial,San Serif; font-size: 10px; text-decoration: underline }
a.nav:hover  { font-family: Verdana,Arial,San Serif; font-size: 10px; text-decoration: none; color: red }
.HEADING     { cursor: hand; font-family: Verdana,Arial,San Serif; font-size: 11px; color: blue;
               font-weight: none;
               border: 1 solid #000000 }
.LINKSOFF    { display: none; font-family: Verdana,Arial,San Serif; font-size: 12px; color: #000000; }
.LINKSON     { display: inline; font-family: Verdana,Arial,San Serif; font-size: 12px; color: #000000; }
-->
</style>

<Script Language="VBscript">
// Copyright 2001 Stephen Hayes (steve@obtsolutions.co.uk)
// OBT Solutions UK (http://www.obtsolutions.co.uk)
// Permission granted to SimplytheBest.net to feature script in its
// DHTML script collection at http://simplythebest.net/info/dhtml_scripts.html
<!--
Option Explicit
DIM menuID,menuObj,cellBk
SUB ShowHide(menuID)
menuObj = "Link" & menuID
cellbk = "Head" & menuID
// CHECK IF OPEN
if document.all.item(menuObj).className = "LINKSON" then    'IF MENU OPEN THEN CLOSE
document.all.item(menuObj).className = "LINKSOFF"
document.all.item(cellBk).style.backgroundColor = "#FFFFFF"   ' SET CELL BACKGROUND COLOUR BLUE
ELSE
document.all.item(menuObj).className = "LINKSON"               ' OPEN MENU
document.all.item(cellBk).style.backgroundColor = "#FFFFFF"  ' SET CELL BACKGROUND COLOUR RED
END IF
END SUB
-->
</Script>


<script language='javascript'>

var errMsgL="";
function commaEmailValidate(emailsSeperateWithCommas)
{
    errMsgL="";
    errMsg="";
	var emailAry = emailsSeperateWithCommas.split(",");
	for(var x=0;x<emailAry.length;x++)
	{
        var str=emailAry[x].replace(/^\s+/,'').replace(/\s+$/,'');
        if( str.length > 0 )
        {
            errMsg="";
            if( !ValidEMail(str) )
            {
                errMsgL=errMsgL + str + " , ";
            }
        }
	}
    if( errMsgL == "")
    {
	    return true;
    }
    else
    {
        if( errMsgL.length > 2 )
        {
            errMsgL=errMsgL.substring(0,errMsgL.length-2);
        }
        return false;
    }
}

function validateTo()
{
    var checkCount = 0;
    if(document.sendAckMailForm.toUsers.value==0)
    {
        document.sendAckMailForm.txtErrMsg.value = 'To cannot be blank';
        return false;
    }


    if ( document.sendAckMailForm.toUsers.length == null )
    {
        if(commaEmailValidate(document.sendAckMailForm.toUsers.value)==false)
        {
             document.sendAckMailForm.txtErrMsg.value="Enter valid email address : " + errMsgL;
             document.sendAckMailForm.toUsers.focus();
             return false;
        }
        else
        {
            document.sendAckMailForm.txtErrMsg.value="";
            return true;
        }
    }
    else
    {

        var nullEmailCount = 0;
        for ( var i=0; i < document.sendAckMailForm.toUsers.length; i++ )
        {
            if( document.sendAckMailForm.toUsers[i].value.length == 0 )
            {
                nullEmailCount++;
            }
        }

        if( nullEmailCount == document.sendAckMailForm.toUsers.length )
        {
            document.sendAckMailForm.txtErrMsg.value = 'To cannot be blank';
            return false;
        }

        for ( var i=0; i < document.sendAckMailForm.toUsers.length; i++ )
        {
            if(commaEmailValidate(document.sendAckMailForm.toUsers[i].value)==false)
            {
                 document.sendAckMailForm.txtErrMsg.value="Enter valid email address : " + errMsgL;
                 document.sendAckMailForm.toUsers[i].focus();
                 return false;
            }
            else
            {
                checkCount++;
            }

        }
        if ( parseInt(checkCount) > 0 )
        {
            document.sendAckMailForm.txtErrMsg.value="";
            return true;
        }
        else
        {
            return false;
        }

    }
}
function validateCC()
{
    var checkCount=0;
    if ( document.sendAckMailForm.ccUsers.length == null )
    {
        if(commaEmailValidate(document.sendAckMailForm.ccUsers.value)==false)
        {
             document.sendAckMailForm.txtErrMsg.value="Enter valid email address : " + errMsgL;
             document.sendAckMailForm.ccUsers.focus();
             return false;
        }
        else
        {
            document.sendAckMailForm.txtErrMsg.value="";
            return true;
        }
    }
    else
    {
        for ( var i=0; i < document.sendAckMailForm.ccUsers.length; i++ )
        {
            if(commaEmailValidate(document.sendAckMailForm.ccUsers[i].value)==false)
            {
                 document.sendAckMailForm.txtErrMsg.value="Enter valid email address : " + errMsgL;
                 document.sendAckMailForm.ccUsers[i].focus();
                 return false;
            }
            else
            {
                checkCount++;
            }
        }
    }
    if ( parseInt(checkCount) == parseInt(document.sendAckMailForm.ccUsers.length) )
    {
        document.sendAckMailForm.txtErrMsg.value="";
        return true;
    }
    else
    {
        return false;
    }


}
function validateBCC()
{
var checkCount=0;
    if ( document.sendAckMailForm.bccUsers.length == null )
    {
        if(commaEmailValidate(document.sendAckMailForm.bccUsers.value)==false)
        {
             document.sendAckMailForm.txtErrMsg.value="Enter valid email address : " + errMsgL;
             document.sendAckMailForm.bccUsers.focus();
             return false;
        }
        else
        {
            document.sendAckMailForm.txtErrMsg.value="";
            return true;
        }
    }
    else
    {
        for ( var i=0; i < document.sendAckMailForm.bccUsers.length; i++ )
        {
            if(commaEmailValidate(document.sendAckMailForm.bccUsers[i].value)==false)
            {
                 document.sendAckMailForm.txtErrMsg.value="Enter valid email address : " + errMsgL;
                 document.sendAckMailForm.bccUsers[i].focus();
                 return false;
            }
            else
            {
                checkCount++;
            }
        }
        if ( parseInt(checkCount) == parseInt(document.sendAckMailForm.bccUsers.length) )
        {
            document.sendAckMailForm.txtErrMsg.value="";
            return true;
        }
        else
        {
            return false;
        }
    }

}
function validateSubject()
{
    if(alphanumSpecialChar(document.sendAckMailForm.subject.value,"Subject","N")==false)
    {
         document.sendAckMailForm.txtErrMsg.value=errMsg;
         document.sendAckMailForm.subject.focus();
         return false;
     }
     else
     {
        return true;
     }
}
function validateMessage()
{
    if( parseInt(document.sendAckMailForm.message.value.length) > 1000 )
    {
         document.sendAckMailForm.txtErrMsg.value="Message should not contain more than 1000 characters";
         document.sendAckMailForm.message.focus();
         return false;
     }
     else
     {
        return true;
     }
}
function sendMail()
{
	var flag=false;
    if( document.getElementById('link0').className == 'LINKSOFF')
    {
        document.sendAckMailForm.ccUsers.value = '';
        for ( var i=0; i < document.sendAckMailForm.ccUsers.length; i++ )
        {
            document.sendAckMailForm.ccUsers[i].value = '';
        }
    }
    if( document.getElementById('link1').className == 'LINKSOFF')
    {
        document.sendAckMailForm.bccUsers.value = '';
        for ( var i=0; i < document.sendAckMailForm.bccUsers.length; i++ )
        {
            document.sendAckMailForm.bccUsers[i].value = '';
        }
    }
    if (  (validateTo() == true) && (validateCC()==true) && (validateBCC()==true) && ( validateSubject() == true ) && ( validateMessage() == true )  )
    {
        document.sendAckMailForm.submit();
    }

}
    function showContactPersonMailIds()
    {
		var salesOrderId    = document.sendAckMailForm.salesOrderId.value;
		var customerId      = document.sendAckMailForm.customerId.value;
		var showAgain       = document.sendAckMailForm.showAgain.value;

        //newWindow = window.open ('sendAckMail.do?action=showContactPersonDetails&salesOrderId='+salesOrderId,'optionsPopup1','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=600,height=500,resizable=no');
		newWindow = window.open ('contactPersonAddressBook.do?action=showContactPersons&salesOrderId=' + salesOrderId + '&customerId=' + customerId + '&showAgain=' + showAgain,'optionsPopup1','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=650,height=500,resizable=no');
		newWindow.focus();
	}

var emailCount = 0;
function newEmail( fieldName, fieldLabel, fontId, colorCode )
{

    var htmltext1 = '<table cellspacing=0 cellpadding=0 width="100%"><tr><td width="15%"><font class="NArialL" ><font color="' + colorCode + '">' + fieldLabel + ':</font></font></td><td width="85%"><input type="text" name="' + fieldName + '" size="40" maxlength="100" class="txfield"></td></tr></table>';
    var pa1 = document.getElementById (fontId);
    emailCount = emailCount + 1;

    if( emailCount == 8 )
    {
        window.resizeTo( 800, 700 );
    }

    pa1.insertAdjacentHTML ('BeforeEnd',htmltext1);

}

function showCC()
{

}

function showBCC()
{

}

</script>
</HEAD>
<BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0" >
<%
 String heading = "";
 String isSample = "1";
%>
<% if((request.getParameter("isSample") != null) && (request.getParameter("isSample").equals("0"))) {
    heading = "Sample Order"; isSample="0";
%>

<% } else {
    heading = "Sales Order";isSample="1";
%>

<% } %>
<html:form name="sendAckMailForm"  type="com.scalar.chiptrack.sales.forms.SendAckMailForm" action="/sendAckMail.do">
<table bgcolor='#FFFFFF' border='1' cellpadding='0' cellspacing='0' width='100%' bordercolor='#993333'>
<tr><td>
<table cellpadding='0' cellspacing='0' bgcolor='FDF5E6' border="0" width="100%" align=center>

    <tr><td valign=center colspan='2' bgcolor="#993333" align='center'><font class='NArialW'><font color='#FFFFFF'><img height=20 width='28' src="<%=chipTracContext%>/jsp/includes/images/email_icon.jpg">&nbsp;<%=heading%> Acknowledgement Mail</font></font></td></tr>

    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td ><chiptrack:errors styleClass="NArialL"/>
        </td>
    </tr>

    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td><chiptrack:info styleClass="NArialL"/></td>
    </tr>

    <tr>
        <td colspan='2' align='right' valign=center>
        <a href="javascript:window.close();" title='Click here to close this window' onMouseOver="window.status='Click here to close this window';return true"><font class='NArialL'><b>[Close this window]</b></font></a>&nbsp;&nbsp;&nbsp;&nbsp;
        </td>
    </tr>
    <tr><td colspan='2'><img height=5 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td></tr>
    <tr align="right"> 
        <td width="50%"><font class="NArialL" >&nbsp;</font></td>
        <td align="right">
            <table cellpadding='0' cellspacing='0' border='0' width='100%' class='NArialL'>
                <tr>
                    <td width="50%"><font color='#003333'>&nbsp;</font></td>
                    <td width="50%">
                    <font class='NArialS'><font color='orange'><li>Type Email Address, separated by commas. <li>To send<%= "0".equals ( isSample ) ? " Sample" : "" %> Sales Order Acknowledgement to other Emails that are not present in the system, click on <b>[+]</b> </font></font>
                    </td>
            </table>
        </td>
    </tr>
    <tr>
    <td width="20%"><font class="NArialL" >&nbsp;</font></td>
    <td  bgcolor='#FDF5E6'><INPUT align=left border=0
                        maxLength=100 name="txtErrMsg" size=100
                        style="BACKGROUND-COLOR:#FDF5E6; BORDER-BOTTOM: thin; BORDER-LEFT-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-TOP: thin; CLEAR: none; COLOR: red;font-family: arial;font-size: 10pt;font-weight:bold " value="" readOnly>
    </td>
    <tr><td colspan='2'><img height=5 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td></tr>
    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td >
            <table cellpadding='0' cellspacing='0' border='0' width='100%' class='NArialL'>
                <tr>
                    <td width="15%"><font color='#003333'>From:</font></td>
                    <td width="85%">
                        <bean:write name='sendAckMailForm' property='fromUser'/>
                        <html:hidden name='sendAckMailForm' property='fromUser'/>
                    </td>
				</tr>

					<tr>
					<td width="15%">&nbsp;</td>
					<td width="85%"> <font class="NArialL">Please &nbsp;&nbsp;<a styleClass="leftsection" href="javascript:showContactPersonMailIds()" onmouseover="window.status='Click to show Contact Person MailIds';return true" onmouseout="window.status='';return true">click here</a>&nbsp;&nbsp;to select MailIds</font></td>
                </tr>
            </table>
        </td>
    </tr>

    <tr><td colspan='2'><img height=5 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td></tr>

    <!-- DISPLAY "TO" VALUES - START - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <tr>
        <td width="20%">&nbsp;</td>
        <td >

            <table cellpadding='0' cellspacing='0' border='0' width='100%' class='NArialL'>
                <%
                    boolean addto = false;
                    String[] toUsers = sendAckMailForm.getToUsers();
                    String mailto = "";
                    if( ( toUsers != null ) && ( toUsers.length == 1 ) )  // above line Comment and this Added  by Krishna Prasad on 14 May 2004, by default toUsers object contain one element with empty string value
                    {
                            if( ( toUsers[0] != null ) && ( toUsers[0].trim().length() != 0 ) )
                            {
                                mailto = toUsers[0];
                            }
						%>
							<tr>
							<td width="15%" class='NArialL'>
							<font color='#990000'>TO:</font>
							<br><br><a ID='head0' CLASS="HEADING" ONCLICK='ShowHide(0)'><font class='NArialS'>[Show CC]</font></a>
							<br><a ID='head1' CLASS="HEADING" ONCLICK='ShowHide(1)'><font class='NArialS'>[Show BCC]</font></a>
							</td>
							<td width='50%'>
						    <input type="text" name="toUsers" size="40" maxlength='100' value="<%=mailto%>" class="txfield">
                            <a href="javascript:newEmail( 'toUsers', 'TO', 'font1', '#990000' )" title='Click to add other Emails'><img border=0 src='<%=chipTracContext%>/jsp/includes/images/add.jpg' height='15' width='20' align=center></a>
							</td>
							<td width='35%' align=left>
							</td>
							</tr>
                <%  }
                    else if( toUsers != null )
                    {
                        StringBuffer mailTo = new StringBuffer();
                        for( int i=0; i<toUsers.length; i++ )
                        {
                            if( ( toUsers[i] != null ) && ( toUsers[i].trim().length() != 0 ) ) 
                            {
                                if(mailTo.length() == 0){
                                mailTo.append(toUsers[i]);
                                }
                                else{
                                mailTo.append(", "+toUsers[i]);
                                }
                            }
                        }
								%>
                                <tr>
                                <td width="15%"><font class="NArialL" ><font color='#990000'>TO:</font></font>
                                <%
                                if( !addto )
                                {
                                %>
                                    <br><br><a ID='head0' CLASS="HEADING" ONCLICK='ShowHide(0)'><font class='NArialS'>[Show CC]</font></a>
                                    <br><a ID='head1' CLASS="HEADING" ONCLICK='ShowHide(1)'><font class='NArialS'>[Show BCC]</font></a>
                                <%
                                }
                                %>
                                </td>
                                <td width='85%'><input type="text" name="toUsers" value='<%=mailTo%>' size="40" maxlength='100' class="txfield">
								<%
								if( !addto )
								{
										addto = true;
									%>
										<font class='NArialS'><b><a href="javascript:newEmail( 'toUsers', 'TO', 'font1', '#990000' )" title='Click to add other Emails'><img border=0 src='<%=chipTracContext%>/jsp/includes/images/add.jpg' height='15' width='20' align=center></a></b></font>
									<%
								}

								%>
                                </td></tr>
								<%

                  }
                  else
                  {  %>
                        <tr>
							<td width="15%" class='NArialL'>
							<font color='#990000'>TO:</font>
							<br><br><a ID='head0' CLASS="HEADING" ONCLICK='ShowHide(0)'><font class='NArialS'>[Show CC]</font></a>
							<br><a ID='head1' CLASS="HEADING" ONCLICK='ShowHide(1)'><font class='NArialS'>[Show BCC]</font></a>
							</td>
							<td width='50%'>
						    <input type="text" name="toUsers" size="40" maxlength='100' value="<%=mailto%>" class="txfield">
                            <a href="javascript:newEmail( 'toUsers', 'TO', 'font1', '#990000' )" title='Click to add other Emails'><img border=0 src='<%=chipTracContext%>/jsp/includes/images/add.jpg' height='15' width='20' align=center></a>
							</td>
							<td width='35%' align=left>
							</td>
                        </tr>
                       <%
                    }
                       %>
            </table>

        </td>
    </tr>

    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td ><font id="font1"></font></td>
    </tr>
<tr>
<td colspan='2'>
<%
    boolean addcc = false;
    String[] ccUsers = sendAckMailForm.getCcUsers();
    if(ccUsers==null || ccUsers.length == 0)
    {
%>
<div ID='link0' CLASS="LINKSOFF">
<%
    }
    else
    {
%>
<div ID='link0'>
<%
    }
%>
    <table cellpadding='0' cellspacing='0' border='0' width='100%' style="BORDER-BOTTOM: thin; BORDER-LEFT-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-TOP: thin; CLEAR: none;" >
    <tr><td colspan='2'><font class="NArialL" >&nbsp;</font></td></tr>
    <tr>
        <td><font class="NArialL" >&nbsp;</font></td>
        <td >

            <table cellpadding='0' cellspacing='0' border='0' width='100%' class='NArialL'>
                <%
                    if( ( ccUsers == null ) || ( ccUsers.length == 0 ) )
                    {
                %>
                    <tr>
                        <td width="15%">
                            <font color='#660033'>CC:</font>
                            <br><br><a CLASS="HEADING" ONCLICK='ShowHide(0)'><font class='NArialS'>[Hide CC]</font></a>
                        </td>
                        <td width='85%' valign=center>
							<input type="text" name="ccUsers" size="40" maxlength='100' class="txfield" >
                            <font class='NArialS'><b><a href="javascript:newEmail('ccUsers', 'CC', 'font2', '660033')"  title='Click to add other Emails'><img border=0 src='<%=chipTracContext%>/jsp/includes/images/add.jpg' height='15' width='20' align=center></a></b></font>
                        </td>
                    </tr>
                <%  }
                    else
                    {
                        for( int i=0; i<ccUsers.length; i++ )
                        {
                            if( ( ccUsers[i] != null) && ( ccUsers[i].trim().length() != 0 ) )
                            {
                %>
                            <tr>
                                <td width="15%"><font class="NArialL"><font color='#660033'>CC:</font></font>
                                <%
                                if( !addcc )
                                { %>
                                    <br><br><a CLASS="HEADING" ONCLICK='ShowHide(0)'><font class='NArialS'>[Hide CC]</font></a>
                                <% } %>
                                </td>
                                <td width='85%'><input type="text" name="ccUsers" value='<%=ccUsers[i]%>' size="40" maxlength='100' class="txfield">
                <%
                        if( !addcc )
                        {
                            addcc = true;
                %>
                            <font class='NArialS'><b><a href="javascript:newEmail('ccUsers', 'CC', 'font2', '#660033')"  title='Click to add other Emails'><img border=0 src='<%=chipTracContext%>/jsp/includes/images/add.jpg' height='15' width='20' align=center></a></b></font>
                <%
                        }
                %>
                    </td></tr>
                <%
                            }
                        }
                    }
                %>
            </table>

        </td>
    </tr>

    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td ><font id="font2"></font></td>
    </tr>

</table>
</div>
</td></tr>

    <!-- DISPLAY "CC" VALUES - END - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<tr>
<td colspan='2'>
<%
    boolean addbcc = false;
    String[] bccUsers = sendAckMailForm.getBccUsers();
    if(bccUsers == null || bccUsers.length == 0)
    {
%>
<div ID='link1' CLASS="LINKSOFF">
<%
    }
    else
    {
%>
<div ID='link1' >
<%
    }
%>
    <table cellpadding='0' cellspacing='0' border='0' width='100%' style="BORDER-BOTTOM: thin; BORDER-LEFT-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-TOP: thin; CLEAR: none;" >

    <tr><td colspan='2'><font class="NArialL" >&nbsp;</font></td></tr>

    <!-- DISPLAY "BCC" VALUES - START - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td >

            <table cellpadding='0' cellspacing='0' border='0' width='100%' class='NArialL'>
                <%
                    if( ( bccUsers == null ) || ( bccUsers.length == 0 ) )
                    {
                %>

                    <tr>
                        <td width="15%">
                            <font color='#003333'>BCC:</font>
                            <br><br><a CLASS="HEADING" ONCLICK='ShowHide(1)'><font class='NArialS'>[Hide BCC]</font></a>
                        </td>
                        <td width='85%'>
							 <input type="text" name="bccUsers" size="40" maxlength='100' class="txfield">
                            <font class='NArialS'><b><a href="javascript:newEmail('bccUsers', 'BCC', 'font3', '#003333')"  title='Click to add other Emails'><img border=0 src='<%=chipTracContext%>/jsp/includes/images/add.jpg' height='15' width='20' align=center></a></b></font>
                        </td>
                    </tr>
                <%  }
                    else
                    {
                        for( int i=0; i<bccUsers.length; i++ )
                        {
                            if( ( bccUsers[i] != null ) && ( bccUsers[i].trim().length() != 0 ) )
                            {
                %>
                            <tr>
                                <td width="15%"><font class="NArialL"><font color='#003333'>BCC:</font></font>
                                <%
                                    if( !addbcc )
                                    {
                                    %>
                                    <br><br><a CLASS="HEADING" ONCLICK='ShowHide(1)'><font class='NArialS'>[Hide BCC]</font></a>
                                    <%
                                    }
                                %>

                                </td>
                                <td width='85%'><input type="text" name="bccUsers" value='<%=bccUsers[i]%>' size="40" maxlength='100' class="txfield">
                <%
                        if( !addbcc )
                        {
                            addbcc = true;
                %>
                            <font class='NArialS'><b><a href="javascript:newEmail('bccUsers', 'BCC', 'font3', '#003333')"  title='Click to add other Emails'><img border=0 src='<%=chipTracContext%>/jsp/includes/images/add.jpg' height='15' width='20' align=center></a></b></font>
                <%
                        }
                %>
                    </td></tr>
                <%
                            }
                        }
                    }
                %>
            </table>

        </td>
    </tr>

    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td ><font id="font3"></font></td>
    </tr>

</table>
</div>
</td></tr>

    <!-- DISPLAY "BCC" VALUES - END - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <tr><td colspan='2'><font class="NArialL" >&nbsp;</font></td></tr>

    <tr><td colspan='2'><img height=5 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td></tr>
    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td >
            <table cellpadding='0' cellspacing='0' border='0' width='100%' class='NArialL'>
                <tr>
                    <td width="15%"><font class="NArialL" ><font color='#003333'>Subject:</font></font></td>
                    <td width='85%'><html:text name='sendAckMailForm' property='subject' size='40' maxlength='200' styleClass='txfield'/></td>
                </tr>
            </table>
        </td>
    </tr>

    <tr><td colspan='2'><img height=15 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td></tr>

    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td ><font class="NArialL" >Message:</font></td>
    </tr>

    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td>
            <html:textarea cols="70" rows="5" name='sendAckMailForm' property='message'  styleClass='txfield'/>
            <input type="hidden" name='action' value='save'>

        </td>
    </tr>


    <tr><td colspan='2'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td colspan=2>
            <font class='NArialL'>
               Attach as <html:radio name='sendAckMailForm' property='attachMIMEType' value="HTML" />&nbsp;&nbsp; HTML Format&nbsp;&nbsp;
               <html:radio name='sendAckMailForm' property='attachMIMEType' value="PDF" />&nbsp;&nbsp;Adobe PDF Version&nbsp;&nbsp;
            </font>
        </td>
    </tr>

     <tr><td colspan='2'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>

    <tr><td colspan='2' align=center>

    <logic:notEqual name="isConfirm" value="True" >
    <chiptrack:restrictedLink functionality='<%=Functionality.SALES_NEW_SALES_ORDER%>' action='<%=User.USER_ACTION_MODIFY%>' styleClass="leftsection" href="javascript:sendMail();" > <img  border="0" src="<%=chipTracContext%>/jsp/includes/images/submit.gif"  title="Click here to Send Mail"/></chiptrack:restrictedLink>
    </logic:notEqual>
    <logic:equal name="isConfirm" value="True" >
    <chiptrack:restrictedLink functionality='<%=Functionality.SALES_NEW_SALES_ORDER%>' action='<%=User.USER_ACTION_MODIFY%>' styleClass="leftsection" href="javascript:sendMail();" > <img  border="0" src="<%=chipTracContext%>/jsp/includes/images/confirm.gif"  title="Click here to Send Mail"/></chiptrack:restrictedLink>
    </logic:equal>

    <a href="javascript:window.close();"><img onMouseOver="window.status='Click here to close this window';return true"  border="0" src="<%=chipTracContext%>/jsp/includes/images/cancel.gif" width="53" height="17"></a>
    </td></tr>

    <tr><td><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>

    <tr><td colspan='2'><br><br><br><br><br><br><br><br><br><br><br><br></td></tr>
	<%
		String salesOrderId = request.getParameter("salesOrderId");
	%>

<input type="hidden" name="salesOrderId" value="<%=salesOrderId%>">
<html:hidden name="sendAckMailForm" property="customerId" />
<input type="hidden" name="showAgain" value="<%=request.getAttribute("showAgain")%>">
</table>
</table>
 </td>
 </tr>
</table>
</html:form>


</BODY>

</html:html>